diff --git a/buildscripts/download-jars.sh b/buildscripts/download-jars.sh index 50f55207e..5518cf9fe 100755 --- a/buildscripts/download-jars.sh +++ b/buildscripts/download-jars.sh @@ -7,7 +7,7 @@ # https://github.com/jfrog/maven-dep-tree # Once you have updated the versions mentioned below, please execute this script from the root directory of the jfrog-cli-core to ensure the JAR files are updated. -GRADLE_DEP_TREE_VERSION="3.1.0" +GRADLE_DEP_TREE_VERSION="3.2.0" # Changing this version also requires a change in mavenDepTreeVersion within utils/java/mvn.go. MAVEN_DEP_TREE_VERSION="1.1.5" diff --git a/cli/docs/flags.go b/cli/docs/flags.go index 865f36ba0..e6a8157ff 100644 --- a/cli/docs/flags.go +++ b/cli/docs/flags.go @@ -7,6 +7,7 @@ import ( "github.com/jfrog/jfrog-cli-core/v2/common/cliutils" pluginsCommon "github.com/jfrog/jfrog-cli-core/v2/plugins/common" "github.com/jfrog/jfrog-cli-core/v2/plugins/components" + "github.com/jfrog/jfrog-cli-security/commands/git/contributors" "github.com/jfrog/jfrog-cli-security/commands/xray/offlineupdate" "github.com/jfrog/jfrog-cli-security/utils" @@ -83,15 +84,16 @@ const ( InsecureTls = "insecure-tls" // Generic command flags - SpecFlag = "spec" - Threads = "threads" - Recursive = "recursive" - RegexpFlag = "regexp" - AntFlag = "ant" - Project = "project" - Exclusions = "exclusions" - IncludeDirs = "include-dirs" - UseWrapper = "use-wrapper" + SpecFlag = "spec" + Threads = "threads" + Recursive = "recursive" + RegexpFlag = "regexp" + AntFlag = "ant" + Project = "project" + Exclusions = "exclusions" + IncludeDirs = "include-dirs" + UseWrapper = "use-wrapper" + UseIncludedBuilds = "use-included-builds" ) const ( @@ -282,6 +284,11 @@ var flagsMap = map[string]components.Flag{ "[Gradle, Maven] Set to true if you'd like to use the Gradle or Maven wrapper.", components.WithBoolDefaultValue(true), ), + UseIncludedBuilds: components.NewBoolFlag( + UseIncludedBuilds, + "[Gradle] Set to true if you'd like to take into account included builds (composite builds) of gradle projects, in addition to including subprojects", + components.WithBoolDefaultValue(false), + ), WorkingDirs: components.NewStringFlag(WorkingDirs, "A comma-separated(,) list of relative working directories, to determine the audit targets locations. If flag isn't provided, a recursive scan is triggered from the root directory of the project."), OutputDir: components.NewStringFlag(OutputDir, "Target directory to save partial results to.", components.SetHiddenStrFlag()), UploadRepoPath: components.NewStringFlag(UploadRepoPath, "Artifactory repository name or path to upload the cyclonedx file to. If no name or path are provided, a local generic repository will be created which will automatically be indexed by Xray.", components.WithStrDefaultValue("import-cdx-scan-results")), diff --git a/cli/scancommands.go b/cli/scancommands.go index 0e134abdb..578968f0f 100644 --- a/cli/scancommands.go +++ b/cli/scancommands.go @@ -18,6 +18,7 @@ import ( "github.com/jfrog/jfrog-cli-core/v2/plugins/components" coreConfig "github.com/jfrog/jfrog-cli-core/v2/utils/config" "github.com/jfrog/jfrog-cli-core/v2/utils/coreutils" + flags "github.com/jfrog/jfrog-cli-security/cli/docs" auditSpecificDocs "github.com/jfrog/jfrog-cli-security/cli/docs/auditspecific" enrichDocs "github.com/jfrog/jfrog-cli-security/cli/docs/enrich" @@ -30,13 +31,14 @@ import ( uploadCdxDocs "github.com/jfrog/jfrog-cli-security/cli/docs/upload" "github.com/jfrog/jfrog-cli-security/utils" + "github.com/jfrog/jfrog-client-go/utils/io/fileutils" + "github.com/jfrog/jfrog-client-go/utils/log" + "github.com/urfave/cli" + "github.com/jfrog/jfrog-cli-security/commands/enrich" "github.com/jfrog/jfrog-cli-security/commands/source_mcp" "github.com/jfrog/jfrog-cli-security/sca/bom/indexer" "github.com/jfrog/jfrog-cli-security/utils/xray" - "github.com/jfrog/jfrog-client-go/utils/io/fileutils" - "github.com/jfrog/jfrog-client-go/utils/log" - "github.com/urfave/cli" "github.com/jfrog/jfrog-cli-security/commands/audit" "github.com/jfrog/jfrog-cli-security/commands/curation" @@ -507,7 +509,8 @@ func CreateAuditCmd(c *components.Context) (string, string, *coreConfig.ServerDe SetNpmScope(c.GetStringFlagValue(flags.DepType)). SetPipRequirementsFile(c.GetStringFlagValue(flags.RequirementsFile)). SetMaxTreeDepth(c.GetStringFlagValue(flags.MaxTreeDepth)). - SetExclusions(pluginsCommon.GetStringsArrFlagValue(c, flags.Exclusions)) + SetExclusions(pluginsCommon.GetStringsArrFlagValue(c, flags.Exclusions)). + SetUseIncludedBuilds(c.GetBoolFlagValue(flags.UseIncludedBuilds)) return xrayVersion, xscVersion, serverDetails, auditCmd, err } diff --git a/commands/audit/auditbasicparams.go b/commands/audit/auditbasicparams.go index 7ea2c0722..7c08e7cfb 100644 --- a/commands/audit/auditbasicparams.go +++ b/commands/audit/auditbasicparams.go @@ -82,6 +82,7 @@ type AuditBasicParams struct { xscVersion string configProfile *xscservices.ConfigProfile solutionFilePath string + useIncludedBuilds bool } func (abp *AuditBasicParams) DirectDependencies() *[]string { @@ -342,3 +343,10 @@ func (abp *AuditBasicParams) SetSolutionFilePath(solutionFilePath string) *Audit abp.solutionFilePath = solutionFilePath return abp } + +func (abp *AuditBasicParams) UseIncludedBuilds() bool { return abp.useIncludedBuilds } + +func (abp *AuditBasicParams) SetUseIncludedBuilds(useIncludedBuilds bool) *AuditBasicParams { + abp.useIncludedBuilds = useIncludedBuilds + return abp +} diff --git a/commands/audit/auditparams.go b/commands/audit/auditparams.go index cc0d28c8d..db5f7152e 100644 --- a/commands/audit/auditparams.go +++ b/commands/audit/auditparams.go @@ -231,7 +231,8 @@ func (params *AuditParams) ToBuildInfoBomGenParams() (bomParams technologies.Bui // Python params PipRequirementsFile: params.PipRequirementsFile(), // Pnpm params - MaxTreeDepth: params.MaxTreeDepth(), + MaxTreeDepth: params.MaxTreeDepth(), + UseIncludedBuilds: params.UseIncludedBuilds(), } return } diff --git a/sca/bom/buildinfo/buildinfobom.go b/sca/bom/buildinfo/buildinfobom.go index fe767126c..7d5eb95a5 100644 --- a/sca/bom/buildinfo/buildinfobom.go +++ b/sca/bom/buildinfo/buildinfobom.go @@ -195,6 +195,7 @@ func GetTechDependencyTree(params technologies.BuildInfoBomGeneratorParams, arti UseWrapper: params.UseWrapper, IsCurationCmd: params.IsCurationCmd, CurationCacheFolder: curationCacheFolder, + UseIncludedBuilds: params.UseIncludedBuilds, }, tech) case techutils.Npm: depTreeResult.FullDepTrees, uniqueDepsIds, err = npm.BuildDependencyTree(params) diff --git a/sca/bom/buildinfo/technologies/common.go b/sca/bom/buildinfo/technologies/common.go index 18df8c650..d408d5af7 100644 --- a/sca/bom/buildinfo/technologies/common.go +++ b/sca/bom/buildinfo/technologies/common.go @@ -10,10 +10,6 @@ import ( buildInfoUtils "github.com/jfrog/build-info-go/utils" "github.com/jfrog/jfrog-cli-core/v2/utils/config" "github.com/jfrog/jfrog-cli-core/v2/utils/tests" - "github.com/jfrog/jfrog-cli-security/utils" - "github.com/jfrog/jfrog-cli-security/utils/techutils" - "github.com/jfrog/jfrog-cli-security/utils/xray" - "github.com/jfrog/jfrog-cli-security/utils/xray/scangraph" "github.com/jfrog/jfrog-client-go/artifactory/services/fspatterns" clientutils "github.com/jfrog/jfrog-client-go/utils" "github.com/jfrog/jfrog-client-go/utils/errorutils" @@ -21,6 +17,11 @@ import ( "github.com/jfrog/jfrog-client-go/utils/log" "github.com/jfrog/jfrog-client-go/xray/services" xscservices "github.com/jfrog/jfrog-client-go/xsc/services" + + "github.com/jfrog/jfrog-cli-security/utils" + "github.com/jfrog/jfrog-cli-security/utils/techutils" + "github.com/jfrog/jfrog-cli-security/utils/xray" + "github.com/jfrog/jfrog-cli-security/utils/xray/scangraph" ) const ( @@ -59,7 +60,8 @@ type BuildInfoBomGeneratorParams struct { // Pnpm params MaxTreeDepth string // NuGet params - SolutionFilePath string + SolutionFilePath string + UseIncludedBuilds bool } func (bbp *BuildInfoBomGeneratorParams) SetNpmScope(depType string) *BuildInfoBomGeneratorParams { diff --git a/sca/bom/buildinfo/technologies/conan/conan_test.go b/sca/bom/buildinfo/technologies/conan/conan_test.go index ef1ca9448..6e9f6a6e1 100644 --- a/sca/bom/buildinfo/technologies/conan/conan_test.go +++ b/sca/bom/buildinfo/technologies/conan/conan_test.go @@ -10,6 +10,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/jfrog/jfrog-cli-core/v2/utils/tests" + "github.com/jfrog/jfrog-cli-security/sca/bom/buildinfo/technologies" ) diff --git a/sca/bom/buildinfo/technologies/java/deptreemanager.go b/sca/bom/buildinfo/technologies/java/deptreemanager.go index 50c0f2da1..5b11857cb 100644 --- a/sca/bom/buildinfo/technologies/java/deptreemanager.go +++ b/sca/bom/buildinfo/technologies/java/deptreemanager.go @@ -31,16 +31,18 @@ type DepTreeParams struct { IsMavenDepTreeInstalled bool IsCurationCmd bool CurationCacheFolder string + UseIncludedBuilds bool } type DepTreeManager struct { - server *config.ServerDetails - depsRepo string - useWrapper bool + server *config.ServerDetails + depsRepo string + useWrapper bool + useIncludedBuilds bool } func NewDepTreeManager(params *DepTreeParams) DepTreeManager { - return DepTreeManager{useWrapper: params.UseWrapper, depsRepo: params.DepsRepo, server: params.Server} + return DepTreeManager{useWrapper: params.UseWrapper, depsRepo: params.DepsRepo, server: params.Server, useIncludedBuilds: params.UseIncludedBuilds} } // The structure of a dependency tree of a module in a Gradle/Maven project, as created by the gradle-dep-tree and maven-dep-tree plugins. @@ -78,10 +80,13 @@ func GetModuleTreeAndDependencies(module *moduleDepTree) (*xrayUtils.GraphNode, childId := GavPackageTypeIdentifier + childName childrenList = append(childrenList, childId) } + moduleTreeMap[dependencyId] = xray.DepTreeNode{ - Classifier: dependency.Classifier, - Types: dependency.Types, - Children: childrenList, + Classifier: dependency.Classifier, + Types: dependency.Types, + Children: childrenList, + Unresolved: dependency.Unresolved, + Configurations: dependency.Configurations, } } return xray.BuildXrayDependencyTree(moduleTreeMap, GavPackageTypeIdentifier+module.Root) diff --git a/sca/bom/buildinfo/technologies/java/gradle.go b/sca/bom/buildinfo/technologies/java/gradle.go index 928ff1005..46a668321 100644 --- a/sca/bom/buildinfo/technologies/java/gradle.go +++ b/sca/bom/buildinfo/technologies/java/gradle.go @@ -163,7 +163,8 @@ func (gdt *gradleDepTreeManager) execGradleDepTree(depTreeDir string) (outputFil "-q", gradleNoCacheFlag, fmt.Sprintf("-Dcom.jfrog.depsTreeOutputFile=%s", outputFilePath), - "-Dcom.jfrog.includeAllBuildFiles=true"} + "-Dcom.jfrog.includeAllBuildFiles=true", + fmt.Sprintf("-Dcom.jfrog.includeIncludedBuilds=%t", gdt.useIncludedBuilds)} // Add curation audit mode for pass-through functionality if this is a curation command if gdt.isCurationCmd { diff --git a/sca/bom/buildinfo/technologies/java/gradle_test.go b/sca/bom/buildinfo/technologies/java/gradle_test.go index 03d81a45a..af0ddb2be 100644 --- a/sca/bom/buildinfo/technologies/java/gradle_test.go +++ b/sca/bom/buildinfo/technologies/java/gradle_test.go @@ -12,6 +12,7 @@ import ( "github.com/jfrog/jfrog-cli-core/v2/utils/coreutils" "github.com/jfrog/jfrog-cli-core/v2/utils/ioutils" "github.com/jfrog/jfrog-cli-core/v2/utils/tests" + "github.com/jfrog/jfrog-cli-security/sca/bom/buildinfo/technologies" "github.com/stretchr/testify/assert" @@ -91,6 +92,30 @@ func TestGradleTreesWithConfig(t *testing.T) { } } +func TestGradleTreesWithConfig_UsingIncludedBuilds(t *testing.T) { + // Create and change directory to test workspace + tempDirPath, cleanUp := technologies.CreateTestWorkspace(t, filepath.Join("projects", "package-managers", "gradle", "gradle-example-included-builds")) + defer cleanUp() + assert.NoError(t, os.Chmod(filepath.Join(tempDirPath, "gradlew"), 0700)) + + // Run getModulesDependencyTrees + modulesDependencyTrees, uniqueDeps, err := buildGradleDependencyTree(&DepTreeParams{UseWrapper: true, UseIncludedBuilds: true}) + if assert.NoError(t, err) && assert.NotNil(t, modulesDependencyTrees) { + assert.Len(t, modulesDependencyTrees, 4) + assert.Len(t, uniqueDeps, 10) + // Check module + module := tests.GetAndAssertNode(t, modulesDependencyTrees, "org.jfrog.test.gradle.publish:api:1.0-SNAPSHOT") + assert.Len(t, module.Nodes, 4) + + // Check direct dependency + directDependency := tests.GetAndAssertNode(t, module.Nodes, "commons-lang:commons-lang:2.4") + assert.Len(t, directDependency.Nodes, 1) + + // Check transitive dependency + tests.GetAndAssertNode(t, directDependency.Nodes, "commons-io:commons-io:1.2") + } +} + func TestIsGradleWrapperExist(t *testing.T) { // Check Gradle wrapper doesn't exist isWrapperExist, err := isGradleWrapperExist() diff --git a/sca/bom/buildinfo/technologies/java/resources/gradle-dep-tree.jar b/sca/bom/buildinfo/technologies/java/resources/gradle-dep-tree.jar index ab3a75838..9ca8c9c8e 100644 Binary files a/sca/bom/buildinfo/technologies/java/resources/gradle-dep-tree.jar and b/sca/bom/buildinfo/technologies/java/resources/gradle-dep-tree.jar differ diff --git a/tests/testdata/projects/package-managers/go/curation-project/go.sum b/tests/testdata/projects/package-managers/go/curation-project/go.sum new file mode 100644 index 000000000..c8bdc71cc --- /dev/null +++ b/tests/testdata/projects/package-managers/go/curation-project/go.sum @@ -0,0 +1,3 @@ +golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +rsc.io/quote v1.5.2/go.mod h1:LzX7hefJvL54yjefDEDHNONDjII0t9xZLPXsUe+TKr0= +rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= diff --git a/tests/testdata/projects/package-managers/gradle/gradle-example-included-builds/.jfrog/projects/gradle.yaml b/tests/testdata/projects/package-managers/gradle/gradle-example-included-builds/.jfrog/projects/gradle.yaml new file mode 100644 index 000000000..7cb5dd938 --- /dev/null +++ b/tests/testdata/projects/package-managers/gradle/gradle-example-included-builds/.jfrog/projects/gradle.yaml @@ -0,0 +1,4 @@ +version: 1 +type: gradle +usePlugin: true +useWrapper: true diff --git a/tests/testdata/projects/package-managers/gradle/gradle-example-included-builds/api/build.gradle b/tests/testdata/projects/package-managers/gradle/gradle-example-included-builds/api/build.gradle new file mode 100644 index 000000000..4eed76a60 --- /dev/null +++ b/tests/testdata/projects/package-managers/gradle/gradle-example-included-builds/api/build.gradle @@ -0,0 +1,81 @@ +configurations { + spi +} + +buildscript { + repositories { + mavenCentral() + } + dependencies { + classpath(group: 'org.jfrog.buildinfo', name: 'build-info-extractor-gradle', version: '4+') + } + configurations.classpath { + resolutionStrategy { + cacheDynamicVersionsFor 0, 'seconds' + cacheChangingModulesFor 0, 'seconds' + } + } +} + +apply plugin: 'com.jfrog.artifactory' +group = 'org.jfrog.test.gradle.publish' +version = currentVersion +status = 'Integration' +repositories { + mavenCentral() +} + +apply plugin: 'java' +apply plugin: 'maven-publish' + +dependencies { + testImplementation 'junit:junit:4.7' +} + +publishing { + publications { + mavenJava(MavenPublication) { + from components.java + artifact(file("$rootDir/gradle.properties")) + } + } +} + +apply plugin: 'ivy-publish' + +publishing { + publications { + ivyJava(IvyPublication) { + from components.java + artifact(file("$rootDir/settings.gradle")) { + name "gradle-settings" + extension "txt" + type "text" + } + // The config below will add a extra attribute to the ivy.xml + // See http://ant.apache.org/ivy/history/latest-milestone/concept.html#extra + descriptor.withXml { + asNode().info[0].attributes().put('e:architecture', 'amd64') + } + } + } +} + +artifactoryPublish { + publications(publishing.publications.ivyJava) + properties { + simpleFile '**:**:**:*@*', simpleFile: 'only on settings file' + } +} + +dependencies { + implementation project(':shared') + implementation module("commons-lang:commons-lang:2.4") { + dependency("commons-io:commons-io:1.2") + } + implementation group: 'org.apache.wicket', name: 'wicket', version: '1.3.7' + +} + +// Just a smoke test that using this option does not lead to any exception +compileJava.options.compilerArgs = ['-Xlint:unchecked'] diff --git a/tests/testdata/projects/package-managers/gradle/gradle-example-included-builds/api/gradle.properties b/tests/testdata/projects/package-managers/gradle/gradle-example-included-builds/api/gradle.properties new file mode 100644 index 000000000..266947aa2 --- /dev/null +++ b/tests/testdata/projects/package-managers/gradle/gradle-example-included-builds/api/gradle.properties @@ -0,0 +1,3 @@ +currentVersion=1.0-SNAPSHOT +artifactory_user=admin +artifactory_password=password diff --git a/tests/testdata/projects/package-managers/gradle/gradle-example-included-builds/api/settings.gradle b/tests/testdata/projects/package-managers/gradle/gradle-example-included-builds/api/settings.gradle new file mode 100644 index 000000000..588965a05 --- /dev/null +++ b/tests/testdata/projects/package-managers/gradle/gradle-example-included-builds/api/settings.gradle @@ -0,0 +1,5 @@ +rootProject.name = 'api' +//include 'proj' + +include ':shared' +project(':shared').projectDir=file("$rootDir/../shared") \ No newline at end of file diff --git a/tests/testdata/projects/package-managers/gradle/gradle-example-included-builds/api/src/main/java/org/gradle/api/PersonList.java b/tests/testdata/projects/package-managers/gradle/gradle-example-included-builds/api/src/main/java/org/gradle/api/PersonList.java new file mode 100644 index 000000000..1d80a16b3 --- /dev/null +++ b/tests/testdata/projects/package-managers/gradle/gradle-example-included-builds/api/src/main/java/org/gradle/api/PersonList.java @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2011 JFrog Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.gradle.api; + +import org.gradle.apiImpl.Impl; +import org.gradle.shared.Person; + +import java.util.ArrayList; + + +public class PersonList { + private ArrayList persons = new ArrayList(); + + public void doSomethingWithImpl() { + org.apache.commons.lang.builder.ToStringBuilder stringBuilder; + try { + Class.forName("org.apache.commons.io.FileUtils"); + } catch (ClassNotFoundException e) { + throw new RuntimeException(e); + } + new Impl().implMethod(); + } + +} diff --git a/tests/testdata/projects/package-managers/gradle/gradle-example-included-builds/api/src/main/java/org/gradle/api/package.html b/tests/testdata/projects/package-managers/gradle/gradle-example-included-builds/api/src/main/java/org/gradle/api/package.html new file mode 100644 index 000000000..cea998a80 --- /dev/null +++ b/tests/testdata/projects/package-managers/gradle/gradle-example-included-builds/api/src/main/java/org/gradle/api/package.html @@ -0,0 +1,19 @@ + + + +

These are the API classes

+ diff --git a/tests/testdata/projects/package-managers/gradle/gradle-example-included-builds/api/src/main/java/org/gradle/apiImpl/Impl.java b/tests/testdata/projects/package-managers/gradle/gradle-example-included-builds/api/src/main/java/org/gradle/apiImpl/Impl.java new file mode 100644 index 000000000..76cf0cc22 --- /dev/null +++ b/tests/testdata/projects/package-managers/gradle/gradle-example-included-builds/api/src/main/java/org/gradle/apiImpl/Impl.java @@ -0,0 +1,26 @@ +/* + * Copyright (C) 2011 JFrog Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.gradle.apiImpl; + + +public class Impl { + + public void implMethod() { + double a = 4.0 * 4; + } + +} diff --git a/tests/testdata/projects/package-managers/gradle/gradle-example-included-builds/build.gradle b/tests/testdata/projects/package-managers/gradle/gradle-example-included-builds/build.gradle new file mode 100644 index 000000000..7214b9e74 --- /dev/null +++ b/tests/testdata/projects/package-managers/gradle/gradle-example-included-builds/build.gradle @@ -0,0 +1,76 @@ +/* + * Copyright (C) 2013 JFrog Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +buildscript { + repositories { + mavenCentral() + } + dependencies { + classpath(group: 'org.jfrog.buildinfo', name: 'build-info-extractor-gradle', version: '4+') + } + configurations.classpath { + resolutionStrategy { + cacheDynamicVersionsFor 0, 'seconds' + cacheChangingModulesFor 0, 'seconds' + } + } +} + + +allprojects { + apply plugin: 'com.jfrog.artifactory' + group = 'org.jfrog.test.gradle.publish' + version = currentVersion + status = 'Integration' + repositories { + mavenCentral() + } +} + +// Setting this property to true will make the artifactoryPublish task +// skip this module (in our case, the root module): +artifactoryPublish.skip = true + +artifactory { + clientConfig.setIncludeEnvVars(true) + clientConfig.info.addEnvironmentProperty('test.adding.dynVar',new java.util.Date().toString()) + + contextUrl = 'http://127.0.0.1:8081/artifactory' + publish { + repository { + repoKey = 'libs-snapshot-local' // The Artifactory repository key to publish to + username = "${artifactory_user}" // The publisher user name + password = "${artifactory_password}" // The publisher password + // This is an optional section for configuring Ivy publication (when publishIvy = true). + ivy { + ivyLayout = '[organization]/[module]/ivy-[revision].xml' + artifactLayout = '[organization]/[module]/[revision]/[module]-[revision](-[classifier]).[ext]' + mavenCompatible = true //Convert any dots in an [organization] layout value to path separators, similar to Maven's groupId-to-path conversion. True if not specified + } + } + defaults { + // Reference to Gradle publications defined in the build script. + // This is how we tell the Artifactory Plugin which artifacts should be + // published to Artifactory. + publications('mavenJava') + publishArtifacts = true + // Properties to be attached to the published artifacts. + properties = ['qa.level': 'basic', 'dev.team' : 'core'] + publishPom = true // Publish generated POM files to Artifactory (true by default) + publishIvy = true // Publish generated Ivy descriptor files to Artifactory (true by default) + } + } +} diff --git a/tests/testdata/projects/package-managers/gradle/gradle-example-included-builds/gradle.properties b/tests/testdata/projects/package-managers/gradle/gradle-example-included-builds/gradle.properties new file mode 100644 index 000000000..266947aa2 --- /dev/null +++ b/tests/testdata/projects/package-managers/gradle/gradle-example-included-builds/gradle.properties @@ -0,0 +1,3 @@ +currentVersion=1.0-SNAPSHOT +artifactory_user=admin +artifactory_password=password diff --git a/tests/testdata/projects/package-managers/gradle/gradle-example-included-builds/gradle/wrapper/gradle-wrapper.jar b/tests/testdata/projects/package-managers/gradle/gradle-example-included-builds/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 000000000..5c2d1cf01 Binary files /dev/null and b/tests/testdata/projects/package-managers/gradle/gradle-example-included-builds/gradle/wrapper/gradle-wrapper.jar differ diff --git a/tests/testdata/projects/package-managers/gradle/gradle-example-included-builds/gradle/wrapper/gradle-wrapper.properties b/tests/testdata/projects/package-managers/gradle/gradle-example-included-builds/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 000000000..070cb702f --- /dev/null +++ b/tests/testdata/projects/package-managers/gradle/gradle-example-included-builds/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/tests/testdata/projects/package-managers/gradle/gradle-example-included-builds/gradlew b/tests/testdata/projects/package-managers/gradle/gradle-example-included-builds/gradlew new file mode 100755 index 000000000..83f2acfdc --- /dev/null +++ b/tests/testdata/projects/package-managers/gradle/gradle-example-included-builds/gradlew @@ -0,0 +1,188 @@ +#!/usr/bin/env sh + +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=$(save "$@") + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi + +exec "$JAVACMD" "$@" diff --git a/tests/testdata/projects/package-managers/gradle/gradle-example-included-builds/gradlew.bat b/tests/testdata/projects/package-managers/gradle/gradle-example-included-builds/gradlew.bat new file mode 100644 index 000000000..9618d8d96 --- /dev/null +++ b/tests/testdata/projects/package-managers/gradle/gradle-example-included-builds/gradlew.bat @@ -0,0 +1,100 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/tests/testdata/projects/package-managers/gradle/gradle-example-included-builds/services/gradle.properties b/tests/testdata/projects/package-managers/gradle/gradle-example-included-builds/services/gradle.properties new file mode 100644 index 000000000..266947aa2 --- /dev/null +++ b/tests/testdata/projects/package-managers/gradle/gradle-example-included-builds/services/gradle.properties @@ -0,0 +1,3 @@ +currentVersion=1.0-SNAPSHOT +artifactory_user=admin +artifactory_password=password diff --git a/tests/testdata/projects/package-managers/gradle/gradle-example-included-builds/services/settings.gradle b/tests/testdata/projects/package-managers/gradle/gradle-example-included-builds/services/settings.gradle new file mode 100644 index 000000000..f5f747740 --- /dev/null +++ b/tests/testdata/projects/package-managers/gradle/gradle-example-included-builds/services/settings.gradle @@ -0,0 +1,8 @@ +rootProject.name = 'services' +include 'webservice' + +include ':shared' +project(':shared').projectDir=file("$rootDir/../shared") + +include ':api' +project(':api').projectDir=file("$rootDir/../api") \ No newline at end of file diff --git a/tests/testdata/projects/package-managers/gradle/gradle-example-included-builds/services/webservice/build.gradle b/tests/testdata/projects/package-managers/gradle/gradle-example-included-builds/services/webservice/build.gradle new file mode 100644 index 000000000..875ff6f01 --- /dev/null +++ b/tests/testdata/projects/package-managers/gradle/gradle-example-included-builds/services/webservice/build.gradle @@ -0,0 +1,46 @@ +apply plugin: 'war' + +apply plugin: 'java' +apply plugin: 'maven-publish' + +buildscript { + repositories { + mavenCentral() + } + dependencies { + classpath(group: 'org.jfrog.buildinfo', name: 'build-info-extractor-gradle', version: '4+') + } + configurations.classpath { + resolutionStrategy { + cacheDynamicVersionsFor 0, 'seconds' + cacheChangingModulesFor 0, 'seconds' + } + } +} + +apply plugin: 'com.jfrog.artifactory' +group = 'org.jfrog.test.gradle.publish' +version = currentVersion +status = 'Integration' +repositories { + mavenCentral() +} + +dependencies { + testImplementation 'junit:junit:4.7' +} + +publishing { + publications { + mavenJava(MavenPublication) { + from components.java + artifact(file("$rootDir/gradle.properties")) + } + } +} + +dependencies { + implementation project(':shared'), 'commons-collections:commons-collections:3.2@jar', 'commons-io:commons-io:1.2', 'commons-lang:commons-lang:2.4@jar' + implementation group: 'org.apache.wicket', name: 'wicket', version: '1.3.7' + implementation project(':api') +} diff --git a/tests/testdata/projects/package-managers/gradle/gradle-example-included-builds/services/webservice/src/main/java/org/gradle/webservice/TestTest.java b/tests/testdata/projects/package-managers/gradle/gradle-example-included-builds/services/webservice/src/main/java/org/gradle/webservice/TestTest.java new file mode 100644 index 000000000..4843cca41 --- /dev/null +++ b/tests/testdata/projects/package-managers/gradle/gradle-example-included-builds/services/webservice/src/main/java/org/gradle/webservice/TestTest.java @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2011 JFrog Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.gradle.webservice; + +import org.apache.commons.collections.list.GrowthList; +import org.apache.commons.io.FilenameUtils; +import org.apache.commons.lang.builder.ToStringBuilder; +import org.gradle.api.PersonList; +import org.gradle.shared.Person; + +public class TestTest { + private String name; + + public void method() { + FilenameUtils.separatorsToUnix("my/unix/filename"); + ToStringBuilder.reflectionToString(new Person("name")); + new GrowthList(); + new PersonList().doSomethingWithImpl(); // compile with api-spi, runtime with api + } + +} diff --git a/tests/testdata/projects/package-managers/gradle/gradle-example-included-builds/services/webservice/src/test/java/org/gradle/webservice/TestTestTest.java b/tests/testdata/projects/package-managers/gradle/gradle-example-included-builds/services/webservice/src/test/java/org/gradle/webservice/TestTestTest.java new file mode 100644 index 000000000..b8e22a4ad --- /dev/null +++ b/tests/testdata/projects/package-managers/gradle/gradle-example-included-builds/services/webservice/src/test/java/org/gradle/webservice/TestTestTest.java @@ -0,0 +1,31 @@ +/* + * Copyright 2007 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.gradle.webservice; + +import junit.framework.TestCase; + +/** + * @author Hans Dockter + */ +public class TestTestTest extends TestCase { + public void testClasspath() { + new TestTest().method(); + } + + public void testApiCompileClasspath() { + new org.gradle.api.PersonList(); + } +} diff --git a/tests/testdata/projects/package-managers/gradle/gradle-example-included-builds/settings.gradle b/tests/testdata/projects/package-managers/gradle/gradle-example-included-builds/settings.gradle new file mode 100644 index 000000000..3f3ffa403 --- /dev/null +++ b/tests/testdata/projects/package-managers/gradle/gradle-example-included-builds/settings.gradle @@ -0,0 +1,4 @@ +include "shared" + +includeBuild 'api' +includeBuild 'services' \ No newline at end of file diff --git a/tests/testdata/projects/package-managers/gradle/gradle-example-included-builds/shared/build.gradle b/tests/testdata/projects/package-managers/gradle/gradle-example-included-builds/shared/build.gradle new file mode 100644 index 000000000..fb7e86462 --- /dev/null +++ b/tests/testdata/projects/package-managers/gradle/gradle-example-included-builds/shared/build.gradle @@ -0,0 +1,38 @@ +buildscript { + repositories { + mavenCentral() + } + dependencies { + classpath(group: 'org.jfrog.buildinfo', name: 'build-info-extractor-gradle', version: '4+') + } + configurations.classpath { + resolutionStrategy { + cacheDynamicVersionsFor 0, 'seconds' + cacheChangingModulesFor 0, 'seconds' + } + } +} + +apply plugin: 'com.jfrog.artifactory' +group = 'org.jfrog.test.gradle.publish' +version = currentVersion +status = 'Integration' +repositories { + mavenCentral() +} + +apply plugin: 'java' +apply plugin: 'maven-publish' + +dependencies { + testImplementation 'junit:junit:4.7' +} + +publishing { + publications { + mavenJava(MavenPublication) { + from components.java + artifact(file("$rootDir/gradle.properties")) + } + } +} \ No newline at end of file diff --git a/tests/testdata/projects/package-managers/gradle/gradle-example-included-builds/shared/src/main/java/org/gradle/shared/Person.java b/tests/testdata/projects/package-managers/gradle/gradle-example-included-builds/shared/src/main/java/org/gradle/shared/Person.java new file mode 100644 index 000000000..d9ed11ee8 --- /dev/null +++ b/tests/testdata/projects/package-managers/gradle/gradle-example-included-builds/shared/src/main/java/org/gradle/shared/Person.java @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2011 JFrog Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.gradle.shared; + +import java.io.IOException; +import java.util.Properties; + +public class Person { + private String name; + + public Person(String name) { + this.name = name; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String readProperty() throws IOException { + Properties properties = new Properties(); + properties.load(getClass().getClassLoader().getResourceAsStream("org/gradle/shared/main.properties")); + return properties.getProperty("main"); + } +} diff --git a/tests/testdata/projects/package-managers/gradle/gradle-example-included-builds/shared/src/main/java/org/gradle/shared/package-info.java b/tests/testdata/projects/package-managers/gradle/gradle-example-included-builds/shared/src/main/java/org/gradle/shared/package-info.java new file mode 100644 index 000000000..7c5f65caf --- /dev/null +++ b/tests/testdata/projects/package-managers/gradle/gradle-example-included-builds/shared/src/main/java/org/gradle/shared/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright (C) 2011 JFrog Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * These are the shared classes. + */ +package org.gradle.shared; diff --git a/tests/testdata/projects/package-managers/gradle/gradle-example-included-builds/shared/src/main/resources/org/gradle/shared/main.properties b/tests/testdata/projects/package-managers/gradle/gradle-example-included-builds/shared/src/main/resources/org/gradle/shared/main.properties new file mode 100644 index 000000000..68fed4627 --- /dev/null +++ b/tests/testdata/projects/package-managers/gradle/gradle-example-included-builds/shared/src/main/resources/org/gradle/shared/main.properties @@ -0,0 +1,17 @@ +# +# Copyright (C) 2011 JFrog Ltd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +main=mainValue diff --git a/utils/xray/xrayutils.go b/utils/xray/xrayutils.go index b3bec8979..978ad06f1 100644 --- a/utils/xray/xrayutils.go +++ b/utils/xray/xrayutils.go @@ -7,19 +7,23 @@ import ( const MaxUniqueAppearances = 10 type DepTreeNode struct { - Classifier *string `json:"classifier"` - Types *[]string `json:"types"` - Children []string `json:"children"` + Classifier *string `json:"classifier"` + Types *[]string `json:"types"` + Children []string `json:"children"` + Unresolved bool `json:"unresolved,omitempty"` + Configurations *[]string `json:"configurations,omitempty"` } func toNodeTypesMap(depMap map[string]DepTreeNode) map[string]*DepTreeNode { mapOfTypes := map[string]*DepTreeNode{} for nodId, value := range depMap { mapOfTypes[nodId] = nil - if value.Types != nil || value.Classifier != nil { + if value.Types != nil || value.Classifier != nil || value.Configurations != nil { mapOfTypes[nodId] = &DepTreeNode{ - Classifier: value.Classifier, - Types: value.Types, + Classifier: value.Classifier, + Types: value.Types, + Configurations: value.Configurations, + Unresolved: value.Unresolved, } } }