Skip to content

Commit

Permalink
feat: add alternative github bundle urls for dxp
Browse files Browse the repository at this point in the history
  • Loading branch information
lgdd committed Apr 26, 2024
1 parent 3f30ef0 commit 3468c35
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 21 deletions.
2 changes: 1 addition & 1 deletion lfr/pkg/assets/tpl/ws/gradle/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ liferay.workspace.modules.dir=modules
liferay.workspace.themes.dir=themes
liferay.workspace.wars.dir=modules
liferay.workspace.product={{.Product}}
#liferay.workspace.bundle.url={{.BundleUrl}}
#liferay.workspace.bundle.url={{.GithubBundleUrl}}
#liferay.workspace.docker.image.liferay={{.DockerImage}}
1 change: 1 addition & 0 deletions lfr/pkg/assets/tpl/ws/maven/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<properties>
<liferay.bom.version>{{.TargetPlatform}}</liferay.bom.version>
<liferay.workspace.bundle.url>{{.BundleUrl}}</liferay.workspace.bundle.url>
<!-- <liferay.workspace.bundle.url>{{.GithubBundleUrl}}</liferay.workspace.bundle.url> -->
<liferay.repository.url>https://repository-cdn.liferay.com/nexus/content/groups/public/</liferay.repository.url>
<liferay.workspace.environment>local</liferay.workspace.environment>
<liferay.docker.image>{{.DockerImage}}</liferay.docker.image>
Expand Down
12 changes: 9 additions & 3 deletions lfr/pkg/generate/workspace/workspace_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,16 @@ func TestGenerate_Gradle_ShouldHaveExpectedFiles(t *testing.T) {
t.Fatalf("gradle.properties doesn't contain %v", metadata.Product)
}

hasExpectedValue = strings.Contains(string(gradleProps), metadata.BundleUrl)
hasExpectedValue = strings.Contains(string(gradleProps), metadata.GithubBundleUrl)

if !hasExpectedValue {
t.Fatalf("gradle.properties doesn't contain %v", metadata.Product)
t.Fatalf("gradle.properties doesn't contain %v", metadata.GithubBundleUrl)
}

hasExpectedValue = strings.Contains(string(gradleProps), metadata.DockerImage)

if !hasExpectedValue {
t.Fatalf("gradle.properties doesn't contain %v", metadata.Product)
t.Fatalf("gradle.properties doesn't contain %v", metadata.DockerImage)
}

}
Expand Down Expand Up @@ -138,6 +138,12 @@ func TestGenerate_Maven_ShouldHaveExpectedFiles(t *testing.T) {
t.Fatalf("pom.xml doesn't contain %v", metadata.BundleUrl)
}

hasExpectedValue = strings.Contains(string(pomXml), metadata.GithubBundleUrl)

if !hasExpectedValue {
t.Fatalf("pom.xml doesn't contain %v", metadata.GithubBundleUrl)
}

hasExpectedValue = strings.Contains(string(pomXml), metadata.GroupId)

if !hasExpectedValue {
Expand Down
36 changes: 19 additions & 17 deletions lfr/pkg/project/metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,16 @@ import (

// Metadata represents the basic informations associated with a Liferay project
type Metadata struct {
Edition string
Product string
BundleUrl string
TomcatVersion string
TargetPlatform string
DockerImage string
GroupId string
ArtifactId string
Name string
Edition string
Product string
BundleUrl string
GithubBundleUrl string
TomcatVersion string
TargetPlatform string
DockerImage string
GroupId string
ArtifactId string
Name string
}

type Release struct {
Expand Down Expand Up @@ -158,14 +159,15 @@ func NewMetadata(base, version, edition string) (*Metadata, error) {
latestRelease.BuildGithubBundleURL()

return &Metadata{
Edition: edition,
Product: latestRelease.ReleaseKey,
BundleUrl: latestRelease.ReleaseProperties.BundleURL,
TargetPlatform: latestRelease.ReleaseProperties.TargetPlatformVersion,
DockerImage: latestRelease.ReleaseProperties.LiferayDockerImage,
GroupId: strcase.ToDelimited(PackageName, '.'),
ArtifactId: strcase.ToKebab(strings.ToLower(base)),
Name: strcase.ToCamel(strings.ToLower(base)),
Edition: edition,
Product: latestRelease.ReleaseKey,
BundleUrl: latestRelease.ReleaseProperties.BundleURL,
GithubBundleUrl: latestRelease.ReleaseProperties.GithubBundleURL,
TargetPlatform: latestRelease.ReleaseProperties.TargetPlatformVersion,
DockerImage: latestRelease.ReleaseProperties.LiferayDockerImage,
GroupId: strcase.ToDelimited(PackageName, '.'),
ArtifactId: strcase.ToKebab(strings.ToLower(base)),
Name: strcase.ToCamel(strings.ToLower(base)),
}, nil
}

Expand Down

0 comments on commit 3468c35

Please sign in to comment.