[ 
https://issues.apache.org/jira/browse/BEAM-12830?focusedWorklogId=699222&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-699222
 ]

ASF GitHub Bot logged work on BEAM-12830:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 21/Dec/21 06:10
            Start Date: 21/Dec/21 06:10
    Worklog Time Spent: 10m 
      Work Description: lukecwik commented on a change in pull request #16291:
URL: https://github.com/apache/beam/pull/16291#discussion_r772833628



##########
File path: 
buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy
##########
@@ -1785,39 +1785,41 @@ class BeamModulePlugin implements Plugin<Project> {
       // Define common lifecycle tasks and artifact types
       project.apply plugin: 'base'
 
-      project.apply plugin: "com.github.blindpirate.gogradle"
-      project.golang { goVersion = '1.16.5' }
-
-      project.repositories {
-        golang {
-          // Gogradle doesn't like thrift: 
https://github.com/gogradle/gogradle/issues/183
-          root 'git.apache.org/thrift.git'
-          emptyDir()
-        }
-        golang {
-          root 'github.com/apache/thrift'
-          emptyDir()
-        }
-        project.clean.dependsOn project.goClean
-        project.check.dependsOn project.goCheck
-        project.assemble.dependsOn project.goBuild
+      // For some reason base doesn't define a test task  so we define it 
below and make
+      // check depend on it. This makes the Go project similar to the task 
layout like
+      // Java projects, see 
https://docs.gradle.org/4.2.1/userguide/img/javaPluginTasks.png
+      if (project.tasks.findByName('test') == null) {
+        project.task('test') {}
       }
+      project.check.dependsOn project.test
 
-      project.idea {
-        module {
-          // The gogradle plugin downloads all dependencies into the source 
tree here,
-          // which is a path baked into golang
-          excludeDirs += project.file("${project.path}/vendor")
+      def goRootDir = "${project.rootDir}/sdks/go"
+      project.ext.goCmd = "${goRootDir}/run_with_go_version.sh"
 
-          // gogradle's private working directory
-          excludeDirs += project.file("${project.path}/.gogradle")
+      project.tasks.create(name: "goBuild") {
+        ext.goTargets = './...'
+        ext.outputLocation = './build/bin/${GOOS}_${GOARCH}/'
+        doLast {
+          project.exec {
+            // Set these so the substitutions work.
+            // May cause issues for the folks running gradle commands on other 
architectures
+            // and operating systems.
+            environment "GOOS", "linux"
+            environment "GOARCH", "amd64"
+
+            executable 'sh'
+            args '-c', "${project.ext.goCmd} build -o "+ ext.outputLocation + 
' ' + ext.goTargets

Review comment:
       ```suggestion
               args '-c', "${project.ext.goCmd} build -o 
${project.ext.outputLocation} ${project.ext.goTargets}"
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 699222)
    Time Spent: 6h 20m  (was: 6h 10m)

> Remove GoGradle plugin
> ----------------------
>
>                 Key: BEAM-12830
>                 URL: https://issues.apache.org/jira/browse/BEAM-12830
>             Project: Beam
>          Issue Type: Improvement
>          Components: sdk-go
>            Reporter: Robert Burke
>            Assignee: Robert Burke
>            Priority: P2
>          Time Spent: 6h 20m
>  Remaining Estimate: 0h
>
> GoGradle has never been updated to handle Go Modules, and it turns out it 
> leaves .gogradle folders everywhere, which contain it's local gopath, and 
> it's non-writable mod caches. This was the root cause of 
> https://issues.apache.org/jira/browse/BEAM-12829.
> The solution is to stop using it, as it's never been ideal for our use, and 
> replace it with direct shellouts to the go command.
> The main functionality that needs replacing is getting and using a set  Go 
> version so we can be sure what we're testing/validating against and building 
> with, and using a common GoPath/ModuleCache throughout the repo. Otherwise, 
> most instances can be replaced with simple tasks that call the Go function.
> A single module cache, if able to be reused across jenkins builds will also 
> reduce build times. Note that these are for external versioned dependencies 
> anyway, and not for Beam repo code.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to