-
Notifications
You must be signed in to change notification settings - Fork 590
chore(dist): replace wget to curl to download swagger-ui #2277
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
3ae4aac
build: optimize 'download-swagger-ui' in hugegraph-dist
VGalaxies 0a9215f
chore: skip the swagger building if network/curl broken
VGalaxies 0822ac4
chore: extract embedded script as a separate file
VGalaxies eebcded
chore: add maven-enforcer-plugin to check java and maven version
VGalaxies 97e9269
chore: add LICENSE for dist.sh
VGalaxies 2782366
Update dist.sh
imbajin 1534605
chore: move download-swagger-ui to root pom plugin management
VGalaxies 509a4e2
chore: move profiles in hugegraph-dist to root pom
VGalaxies 645258c
chore: assemble for non-unix os
VGalaxies df0779c
chore: rename profile id
VGalaxies db9a9e3
chore: tar package for non-unix os
VGalaxies 264c41c
chore: move package goals to dist pom
VGalaxies ff7a779
chore: comment dependency convergence
VGalaxies 880d283
chore: fix mvn package args
VGalaxies 66d0241
revert "chore: fix mvn package args"
VGalaxies e5929e2
chore: activate profile by property
VGalaxies e5f3642
chore: execute enforcer only in root pom
VGalaxies 7d9e991
chore: revert core-test activation
VGalaxies 3b480f6
doc: add comment for property activation
VGalaxies f707fcb
Update pom.xml
imbajin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| #!/bin/bash | ||
| # | ||
| # Licensed to the Apache Software Foundation (ASF) under one or more | ||
| # contributor license agreements. See the NOTICE file distributed with this | ||
| # work for additional information regarding copyright ownership. The ASF | ||
| # licenses this file to You 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. | ||
| # | ||
| VERSION=4.15.5 | ||
|
|
||
| curl --version >/dev/null 2>&1 || | ||
| { | ||
| echo 'ERROR: Please install `curl` first if you need `swagger-ui`' | ||
| exit | ||
| } | ||
|
|
||
| # TODO: perhaps it's necessary verify the checksum before reusing the existing tar | ||
| if [[ ! -f v$VERSION.tar.gz ]]; then | ||
| curl -s -S -L -o v$VERSION.tar.gz \ | ||
| https://github.com/swagger-api/swagger-ui/archive/refs/tags/v$VERSION.tar.gz || | ||
| { | ||
| echo 'ERROR: Download `swagger-ui` failed, please check your network connection' | ||
| exit | ||
| } | ||
| fi | ||
|
|
||
| tar zxf v$VERSION.tar.gz -C . >/dev/null 2>&1 | ||
|
|
||
| echo "window.onload = function() { window.ui = SwaggerUIBundle({ | ||
| url:'/openapi.json',dom_id:'#swagger-ui',deepLinking:true,layout:'StandaloneLayout', | ||
| presets:[SwaggerUIBundle.presets.apis, SwaggerUIStandalonePreset ], | ||
| plugins:[SwaggerUIBundle.plugins.DownloadUrl]});};" > \ | ||
| swagger-ui-$VERSION/dist/swagger-initializer.js | ||
|
|
||
| # conceal the VERSION from the outside | ||
| mv swagger-ui-$VERSION swagger-ui | ||
| echo 'INFO: Successfully download `swagger-ui`' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -124,30 +124,6 @@ | |
| </resources> | ||
|
|
||
| <plugins> | ||
| <plugin> | ||
| <artifactId>maven-assembly-plugin</artifactId> | ||
| <version>2.4</version> | ||
| <executions> | ||
| <execution> | ||
| <id>assembly-hugegraph</id> | ||
| <phase>package</phase> | ||
| <goals> | ||
| <goal>single</goal> | ||
| </goals> | ||
| <configuration> | ||
| <attach>false</attach> | ||
| <appendAssemblyId>false</appendAssemblyId> | ||
| <outputDirectory>${top.level.dir} | ||
| </outputDirectory> | ||
| <descriptor> | ||
| ${assembly.descriptor.dir}/assembly.xml | ||
| </descriptor> | ||
| <finalName>${final.name}</finalName> | ||
| </configuration> | ||
| </execution> | ||
| </executions> | ||
| </plugin> | ||
|
|
||
| <plugin> | ||
| <groupId>org.apache.maven.plugins</groupId> | ||
| <artifactId>maven-clean-plugin</artifactId> | ||
|
|
@@ -168,51 +144,168 @@ | |
| </filesets> | ||
| </configuration> | ||
| </plugin> | ||
|
|
||
| <plugin> | ||
| <artifactId>maven-antrun-plugin</artifactId> | ||
| <executions> | ||
| <execution> | ||
| <id>download-swagger-ui</id> | ||
| <phase>package</phase> | ||
| <goals> | ||
| <goal>run</goal> | ||
| </goals> | ||
| <configuration> | ||
| <tasks> | ||
| <echo file="${project.basedir}/dist.sh"> | ||
| wget --version 1>/dev/null || exit | ||
| wget https://github.com/swagger-api/swagger-ui/archive/refs/tags/v4.15.5.tar.gz | ||
| tar zxvf v4.15.5.tar.gz | ||
| echo "window.onload = function() { window.ui = SwaggerUIBundle({ | ||
| url:'/openapi.json',dom_id:'#swagger-ui',deepLinking:true,layout:'StandaloneLayout', | ||
| presets:[SwaggerUIBundle.presets.apis, SwaggerUIStandalonePreset ], | ||
| plugins:[SwaggerUIBundle.plugins.DownloadUrl]});};" > swagger-ui-4.15.5/dist/swagger-initializer.js | ||
| cp -r swagger-ui-4.15.5/dist ../${final.name}/swagger-ui | ||
| </echo> | ||
| <exec executable="${shell-executable}" dir="${project.basedir}" failonerror="true"> | ||
| <arg line="./dist.sh"/> | ||
| </exec> | ||
| </tasks> | ||
| </configuration> | ||
| </execution> | ||
| <execution> | ||
| <phase>package</phase> | ||
| <goals> | ||
| <goal>run</goal> | ||
| </goals> | ||
| <configuration> | ||
| <target> | ||
| <tar destfile="${final.destfile}" compression="gzip"> | ||
| <tarfileset dir="${top.level.dir}/" filemode="755"> | ||
| <include name="${final.name}/**"/> | ||
| </tarfileset> | ||
| </tar> | ||
| </target> | ||
| </configuration> | ||
| </execution> | ||
| </executions> | ||
| </plugin> | ||
| </plugins> | ||
|
|
||
| <pluginManagement> | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. need BTW, all the CI failed now 🔎
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| <plugins> | ||
| <plugin> | ||
| <groupId>org.apache.maven.plugins</groupId> | ||
| <artifactId>maven-assembly-plugin</artifactId> | ||
| <version>2.4</version> | ||
| <executions> | ||
| <execution> | ||
| <id>assembly-hugegraph</id> | ||
| <phase>package</phase> | ||
| <goals> | ||
| <goal>single</goal> | ||
| </goals> | ||
| <configuration> | ||
| <attach>false</attach> | ||
| <appendAssemblyId>false</appendAssemblyId> | ||
| <outputDirectory>${top.level.dir} | ||
| </outputDirectory> | ||
| <descriptor> | ||
| ${assembly.descriptor.dir}/assembly.xml | ||
| </descriptor> | ||
| <finalName>${final.name}</finalName> | ||
| </configuration> | ||
| </execution> | ||
| </executions> | ||
| </plugin> | ||
| <plugin> | ||
| <groupId>org.apache.maven.plugins</groupId> | ||
| <artifactId>maven-antrun-plugin</artifactId> | ||
| <version>1.8</version> | ||
| <executions> | ||
| <execution> | ||
| <id>download-swagger-ui</id> | ||
| <phase>prepare-package</phase> | ||
| <goals> | ||
| <goal>run</goal> | ||
| </goals> | ||
| <configuration> | ||
| <target> | ||
| <exec executable="${shell-executable}" | ||
| dir="${project.basedir}" | ||
| failonerror="false"> | ||
| <arg line="./dist.sh"/> | ||
| </exec> | ||
| </target> | ||
| </configuration> | ||
| </execution> | ||
| <execution> | ||
| <id>install-swagger-ui</id> | ||
| <phase>package</phase> | ||
| <goals> | ||
| <goal>run</goal> | ||
| </goals> | ||
| <configuration> | ||
| <target> | ||
| <exec executable="cp" | ||
| dir="${project.basedir}" | ||
| failonerror="false"> | ||
| <arg value="-r"/> | ||
| <arg value="swagger-ui/dist"/> | ||
| <arg value="../${final.name}/swagger-ui"/> | ||
| </exec> | ||
| <exec executable="rm" | ||
| dir="${project.basedir}" | ||
| failonerror="false"> | ||
| <arg value="-rf"/> | ||
| <arg value="swagger-ui"/> | ||
| </exec> | ||
| </target> | ||
| </configuration> | ||
| </execution> | ||
| </executions> | ||
| </plugin> | ||
| </plugins> | ||
| </pluginManagement> | ||
| </build> | ||
|
|
||
| <profiles> | ||
| <profile> | ||
| <id>assembly-hugegraph</id> | ||
| <build> | ||
| <plugins> | ||
| <plugin> | ||
| <artifactId>maven-assembly-plugin</artifactId> | ||
| </plugin> | ||
| </plugins> | ||
| </build> | ||
| <activation> | ||
| <!-- usage refer: https://github.com/apache/hugegraph/pull/2277 --> | ||
| <property> | ||
| <name>!skip-assembly-hugegraph</name> | ||
| </property> | ||
| </activation> | ||
| </profile> | ||
| <profile> | ||
| <id>unix-package</id> | ||
| <build> | ||
| <plugins> | ||
| <plugin> | ||
| <artifactId>maven-antrun-plugin</artifactId> | ||
| </plugin> | ||
| </plugins> | ||
| </build> | ||
imbajin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| <activation> | ||
| <os> | ||
| <family>unix</family> | ||
| <name>Linux</name> | ||
| </os> | ||
| </activation> | ||
| </profile> | ||
| <profile> | ||
| <id>mac-package</id> | ||
| <build> | ||
| <plugins> | ||
| <plugin> | ||
| <artifactId>maven-antrun-plugin</artifactId> | ||
| </plugin> | ||
| </plugins> | ||
| </build> | ||
| <activation> | ||
| <os> | ||
| <family>mac</family> | ||
| </os> | ||
| </activation> | ||
| </profile> | ||
| <profile> | ||
| <id>tar-package</id> | ||
| <build> | ||
| <plugins> | ||
| <plugin> | ||
| <groupId>org.apache.maven.plugins</groupId> | ||
| <artifactId>maven-antrun-plugin</artifactId> | ||
| <version>1.8</version> | ||
| <executions> | ||
| <execution> | ||
| <id>tar-package</id> | ||
| <phase>package</phase> | ||
| <goals> | ||
| <goal>run</goal> | ||
| </goals> | ||
| <configuration> | ||
| <target> | ||
| <tar destfile="${final.destfile}" compression="gzip"> | ||
| <tarfileset dir="${top.level.dir}/" filemode="755"> | ||
| <include name="${final.name}/**"/> | ||
| </tarfileset> | ||
| </tar> | ||
| </target> | ||
| </configuration> | ||
| </execution> | ||
| </executions> | ||
| </plugin> | ||
| </plugins> | ||
| </build> | ||
| <activation> | ||
| <!-- usage refer: https://github.com/apache/incubator-hugegraph/pull/2277 --> | ||
| <property> | ||
| <name>!skip-tar-package</name> | ||
| </property> | ||
| </activation> | ||
| </profile> | ||
| </profiles> | ||
| </project> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.